package com.vsked.util;

public class ExceptionProcess {
	
	public static int inSpaceNum=8;
	
	public static String getTryCatchBlock(String inTryCommandString){
		return Symbol.enterSymbol+Symbol.getSpaceString(inSpaceNum)+"try{"+Symbol.enterSymbol+Symbol.getSpaceString(12)+inTryCommandString+Symbol.enterSymbol+Symbol.getSpaceString(inSpaceNum)+"}catch(Exception e){"+Symbol.enterSymbol+Symbol.getSpaceString(inSpaceNum+4)+"e.printStackTrace();"+Symbol.enterSymbol+Symbol.getSpaceString(inSpaceNum)+"}";
	}
	public static String getTryCatchFinallyBlock(String inTryCommandString){
		return Symbol.enterSymbol+Symbol.getSpaceString(inSpaceNum)+"try{"+Symbol.enterSymbol+Symbol.getSpaceString(12)+inTryCommandString+Symbol.enterSymbol+Symbol.getSpaceString(inSpaceNum)+"}catch(Exception e){"+Symbol.enterSymbol+Symbol.getSpaceString(inSpaceNum+4)+"e.printStackTrace();"+Symbol.enterSymbol+Symbol.getSpaceString(inSpaceNum)+"}finally {"+Symbol.enterSymbol+Symbol.getSpaceString(inSpaceNum+4)+DaoProcess.getDAOConnectionClose()+Symbol.getSpaceString(inSpaceNum)+"}";
	}
	public static String getTryCatchFinallyBlock(String inTryCommandString,String inFinallyDoSomething){
		return Symbol.enterSymbol+Symbol.getSpaceString(inSpaceNum)+"try{"+Symbol.enterSymbol+Symbol.getSpaceString(12)+inTryCommandString+Symbol.enterSymbol+Symbol.getSpaceString(inSpaceNum)+"}catch(Exception e){"+Symbol.enterSymbol+Symbol.getSpaceString(inSpaceNum+4)+"e.printStackTrace();"+Symbol.enterSymbol+Symbol.getSpaceString(inSpaceNum)+"}finally {"+Symbol.enterSymbol+Symbol.getSpaceString(inSpaceNum+4)+inFinallyDoSomething+Symbol.enterSymbol+Symbol.getSpaceString(inSpaceNum)+"}";
	}
	
	public static void main(String[] args) {
		System.out.println(getTryCatchBlock(Symbol.getSpaceString(ExceptionProcess.inSpaceNum+4)+"TbUser tbUser=new TbUser();"));
		System.out.println(getTryCatchFinallyBlock(Symbol.getSpaceString(ExceptionProcess.inSpaceNum+4)+"TbUser tbUser=new TbUser();","Conn.free();"));
	}

}
